home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS26.ADF
/
DC
/
dc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-01-26
|
3KB
|
147 lines
/* Diskchange DF2: V1.0
*
* John Youells
* (For folks with 5 1/4" drives)
*
* SYSOP Jay - QLINK AmigaSIG
* crash!gryphon!pnet02!jyouells - PNET/USENET
*
* 24 July 87
* This program was written using
* ScreenShift 1.0
* by Anson Mah, as a template.
* It is completely in the Public Domain.
* Written for Manx C
*
* compile: cc +L dc.c
* link : ln dc.o c32.lib
* Use FixHunk on the executable if its going to be
* used with expanded memory.
* Enjoy!
*/
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <functions.h>
/* to get rid of those nasty ptr to int warnings */
#define DCGADWIDTH 42 /* gadget proportions */
#define DCGADHEIGHT 13
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase = NULL;
struct Window *dcwin = NULL;
UWORD dcimagedata[] = {
/* BitPlane 0 */
0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,
0x0FFF,0xFFFF,0xFC00,
0x1C1F,0x01E0,0xFE00,
0x3EEF,0xBFDE,0xFF00,
0x3EEF,0xBFFE,0xDF00,
0x3EEF,0x83F9,0xFF00,
0x3EEF,0xBFE7,0xFF00,
0x3EEF,0xBFEF,0xDF00,
0x1C1F,0x1FE0,0xFE00,
0x0FFF,0xFFFF,0xFC00,
0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,
/* BitPlane 1 */
0xFFFF,0xFFFF,0xFFC0,
0xF000,0x0000,0x03C0,
0xEFFF,0xFFFF,0xFDC0,
0xDFFF,0xFFFF,0xFEC0,
0xFFFF,0xFFFF,0xFFC0,
0xFFFF,0xFFFF,0xFFC0,
0xFFFF,0xFFFF,0xFFC0,
0xFFFF,0xFFFF,0xFFC0,
0xFFFF,0xFFFF,0xFFC0,
0xDFFF,0xFFFF,0xFEC0,
0xEFFF,0xFFFF,0xFDC0,
0xF000,0x0000,0x03C0,
0xFFFF,0xFFFF,0xFFC0
};
struct Image dcimage = { 0, 0, 42, 13, 2, &dcimagedata[0], 0x03, 0x00, NULL };
struct Gadget dcgadget = {
NULL, 28, 10, DCGADWIDTH, DCGADHEIGHT, GADGIMAGE | GADGHCOMP ,
RELVERIFY,
BOOLGADGET, (APTR)&dcimage, NULL, NULL, 0, NULL,
0, NULL
};
struct NewWindow dcwindef = {
130, 00,
100, 24,
3, 2,
CLOSEWINDOW | GADGETUP,
WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG | ACTIVATE | SMART_REFRESH
| RMBTRAP,
&dcgadget,
NULL,
(UBYTE *)"DC",
NULL, NULL,
0,0, 0,0,
WBENCHSCREEN
};
void closestuff()
{
if (dcwin) CloseWindow(dcwin);
if (GfxBase) CloseLibrary(GfxBase);
if (IntuitionBase) CloseLibrary(IntuitionBase);
exit(0);
}
void openstuff()
{
IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 33L);
GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 33L);
if (IntuitionBase == NULL || GfxBase == NULL)
closestuff();
if (!(dcwin = (struct Window *)OpenWindow(&dcwindef)))
closestuff(); /* couldn't open window */
}
void _main()
{
struct IntuiMessage *msg;
ULONG class, code;
BOOL success;
openstuff();
for (;;) {
WaitPort(dcwin->UserPort);
msg = (struct IntuiMessage *)GetMsg(dcwin->UserPort);
class = msg->Class;
code = msg->Code;
ReplyMsg(msg);
switch (class) {
case CLOSEWINDOW:
closestuff();
break;
case GADGETUP:
success = Execute("DISKCHANGE df2:",0,0);
break;
}
RefreshGadgets(&dcgadget, dcwin, NULL);
/* fall through */
}
}